const webpack = require('webpack');

module.exports = {
  entry: {
    bundle: './src/index.tsx',
    vendor: ['react', 'react-dom', 'axios']
  },
  output: {
    filename: 'bundle.js',
    path: `${__dirname}/dist`,
  },

  devtool: 'source-map',

  resolve: {
    extensions: ['.css', '.ts', '.tsx', '.js', '.json'],
  },

  module: {
    rules: [
      { test: /\.tsx?$/, use: 'awesome-typescript-loader' },
      { enforce: 'pre', test: /\.js$/, use: 'source-map-loader' },
      { test: /\.css$/, use: ['style-loader', 'css-loader'] },
    ],
  },
  plugins: [
    new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', filename: 'vendor.bundle.js' }),
  ],
};
